package cn.lili.modules.member.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.member.entity.dos.UserAddress;
import cn.lili.modules.member.entity.dto.AddressSearchParams;
import cn.lili.modules.member.fallback.UserAddressFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 用户收货地址client
 *
 * @author liushuai(liushuai711 @ gmail.com)
 * @since 2021/12/7 08:23
 */
@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.USER_SERVICE, contextId = "user-address", fallback = UserAddressFallback.class)
public interface UserAddressClient {

    /**
     * 获取默认的收货地址
     */
    @GetMapping("/feign/user/address/{userId}/default")
    UserAddress getUserDefaultAddress(@PathVariable String userId);

    /**
     * 获取制定用户收货地址
     */
    @GetMapping("/feign/user/address/{id}")
    UserAddress getAddressById(@PathVariable("id") String id);


    /**
     * 获取制定用户收货地址
     */
    @GetMapping("/feign/user/address/{id}/noAuth")
    UserAddress getAddressByIdNoAuth(@PathVariable("id") String id);
    /**
     * 获取制定用户收货地址
     */
    @PostMapping("/feign/user/address/getByParams")
    UserAddress getByParams(@RequestBody AddressSearchParams addressSearchParams);
}
